﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using PPIDesktopClient.General;

namespace PPIDesktopClient.Entities
{
    public class EBasePole : EBasePosition
    {
        #region Private Members
        private Int32 m_Id;
        private EXMissionStructures_PoleTopType m_TopType;
        private EXMissionStructures_PoleSpecies m_Species;
        private EXMissionStructures_PoleTreatment m_Treatment;
        private EXMissionStructures_PoleClass m_Class;
        private Int32 m_Year;
        private string m_AID;
        private Int32 m_LVisit;
        private string m_Number;
        private double m_Length;
        private string m_LVisitor;
        private string m_Title;
        private List<Int32> m_DeletedImages;
        private List<EBaseImage> m_Images;
        private EBaseAsset m_Asset;
        
        #endregion

        #region Properties
        public Int32 Id
        {
            get
            {
                return m_Id;
            }
            set
            {
                m_Id = value;
            }
        }
        public EXMissionStructures_PoleTopType TopType
        {
            get
            {
                return m_TopType;
            }
            set
            {
                m_TopType = value;
            }
        }
        public EXMissionStructures_PoleSpecies Species
        {
            get
            {
                return m_Species;
            }
            set
            {
                m_Species = value;
            }
        }
        public EXMissionStructures_PoleTreatment Treatment
        {
            get
            {
                return m_Treatment;
            }
            set
            {
                m_Treatment = value;
            }
        }
        public EXMissionStructures_PoleClass Class
        {
            get
            {
                return m_Class;
            }
            set
            {
                m_Class = value;
            }
        }
        public Int32 Year
        {
            get
            {
                return m_Year;
            }
            set
            {
                m_Year = value;
            }
        }
        public string AID
        {
            get
            {
                return m_AID;
            }
            set
            {
                m_AID = value;
            }
        }
        public Int32 LVisit
        {
            get
            {
                return m_LVisit;
            }
            set
            {
                m_LVisit = value;
            }
        }
        public string Number
        {
            get
            {
                return m_Number;
            }
            set
            {
                m_Number = value;
            }
        }
        public double Length
        {
            get
            {
                return m_Length;
            }
            set
            {
                m_Length = value;
            }
        }
        public string LVisitor
        {
            get
            {
                return m_LVisitor;
            }
            set
            {
                m_LVisitor = value;
            }
        }
        public string Title
        {
            get
            {
                if (Id == Int32.MinValue)
                    return "Pole " + m_Title;
                else
                    return "Pole " + Id.ToString(); 

            }
            set
            {
                m_Title = value;
            }
        }
        public List<Int32> DeletedImages
        {
            get
            {
                return m_DeletedImages;
            }
            set
            {
                m_DeletedImages = value;
            }
        }
        public List<EBaseImage> Images
        {
            get
            {
                return m_Images;
            }
            set
            {
                m_Images = value;
            }
        }
        public EBaseAsset Asset
        {
            get
            {
                return m_Asset;
            }
            set
            {
                m_Asset = value;
            }
        }
        

        #endregion

        #region Constructors

        public EBasePole()
            : base()
        {
            m_Id = Int32.MinValue;
            m_TopType = new EXMissionStructures_PoleTopType();
            m_Species = new EXMissionStructures_PoleSpecies();
            m_Treatment = new EXMissionStructures_PoleTreatment();
            m_Class = new EXMissionStructures_PoleClass();
            m_Year = Int32.MinValue;
            m_LVisit = Int32.MinValue;
            m_DeletedImages = new List<int>();
            m_Images = new List<EBaseImage>();
            m_Asset = new EBaseAsset();
            m_Length = Double.MinValue;
        }

        public EBasePole(Int32 id)
            : this()
        {
            m_Id = id;
        }

        public EBasePole(Int32 id, EXMissionStructures_PoleTopType topType, EXMissionStructures_PoleSpecies species, EXMissionStructures_PoleTreatment treatment, EXMissionStructures_PoleClass pclass, Int32 year, string aid, Int32 lvisit, string number, double length, string lvisitor)
            : this(id)
        {
            m_TopType = topType;
            m_Species = species;
            m_Class = pclass;
            m_Length = length;
            m_LVisit = lvisit;
            m_LVisitor = lvisitor;
            m_Number = number;
            m_Treatment = treatment;
            m_Year = year;
            m_AID = aid;

        }





        #endregion

        #region Virtual Methods
        

        protected virtual int Insert()
        {
            throw new NotImplementedException();
        }

        protected virtual void Update()
        {
            throw new NotImplementedException();
        }

        public virtual void Delete()
        {
            throw new NotImplementedException();
        }
        public virtual int Save()
        {
            throw new NotImplementedException();
        }

        #endregion

        #region Override Methods

        protected override string GetHtmlName()
        {
            EUtility_QueryAssetTextShow title = GetTextToShow();
            string _Name = "";
            switch (title)
            {
                case EUtility_QueryAssetTextShow.Internal_Utility_ID:
                    _Name = "Pole [ " + m_Id.ToString() + " ]";
                    break;
                case EUtility_QueryAssetTextShow.AID:
                    _Name = "Pole [  ]";
                    break;
                case EUtility_QueryAssetTextShow.Top_Type:
                    _Name = "Pole [ " + TopType.Name + " ]";
                    break;
                default:
                    break;
            }
            return _Name;

        }

        public override bool Equals(object obj)
        {
            if (obj is EBasePole)
            {
                EBasePole tmpObj = (EBasePole)obj;
                return (m_Id == tmpObj.Id);
            }
            return base.Equals(obj);
        }


        #endregion

    }
}
